<?php
/**
 * 邮箱认证
 * @copyright 上海耶恩信息科技有限公司
 * @author 刘南京
 * @version v3.2 2013-10-10
 */
session_start();
include_once dirname(__FILE__)."/include/config.php";

$alias = "index";
$act = getact("index");

switch($act){

	case 'index':
	//认证邮箱
	
	if(empty($_COOKIE['user_id'])){
		header("Location:/user.php");
		exit();
	}
	
	include_once dirname(__FILE__)."/system/lib/checkemail.class.php";
	
	$md = trim($_GET['token']);
	if(empty($md) || strlen($md) <> 32){
		remberIp();
		header("Location:/");
		exit();
	}
	
	$filepath = dirname(__FILE__)."/temp/checkemail/".$md;
	if(!file_exists($filepath)){
		//文件不存在
		remberIp();
		header("Location:/");
		exit();
	}
	
	$body = file_get_contents($filepath);
	
	$body = iconv('gbk','utf-8',$body);
	$aset = explode('###',$body);
	
	$obj = new checkemail();
	if($obj->updateEmail()){
		@unlink($filepath);
		//exit('提示：邮箱认证成功！');
		msg("提示：邮箱认证成功！","/u/");
	}
	//exit('提示：邮箱认证过程发现未知错误，请稍后再试！');
	msg("提示：邮箱认证过程发现未知错误，请稍后再试！","/u/");
	
	break;

}

?>